﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Transactions;
using System.Web;

namespace Async_await.DAL
{
    public class UserDAL : TestDALBase
    {
        User_ProfileDAL user_ProfileDAL;
        LoginLogsDAL loginLogsDAL;
        public UserDAL()
        {
            user_ProfileDAL = new User_ProfileDAL();
            loginLogsDAL = new LoginLogsDAL();
        }
        public  void Insert(Entity.User entity)
        {
            using (TransactionScope trans = new TransactionScope())
            {
                try
                {
                    base.Insert(entity);
                    entity.User_Profile.ID = entity.ID;
                    user_ProfileDAL.Insert(entity.User_Profile);
                    trans.Complete();
                }
                catch (Exception)
                {

                    throw;
                }
                finally
                {
                    trans.Dispose();
                }
            }
        }
    }
}